<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8" isELIgnored="false"%>
<%@ include file="/WEB-INF/views/shared/taglib.jsp"%>
<%
	request.setAttribute("modelConfigPath", "cargo");
%>
<%@ include file="/WEB-INF/views/shared/master/contentHeader.jsp"%>
<%@ include file="/WEB-INF/views/shared/master/index.jsp"%>
<style type="text/css">
	body{overflow-y: hidden;}
	.cntable,.table-responsive{margin-top:0px !important; }
	.tab-pane{margin-top:0px !important;}
	#furnace{margin:0px 0px 0px 0px;padding:0px 0px 0px 0px;border-right:1px solid #ddd;}
	#em{margin:0px 0px 0px 0px;padding:0px 0px 0px 0px;}
	.nav-tabs{padding 0px 0px 0px 0px !important;margin:0px 0px 0px 0px !important; }
</style>
<t:form style="display:none" modelAttribute="purchaseSearch" cssClass="form-horizontal" method="post" ajaxPost="true" onSuccess="onSuccess">

	<t:panel cssClass="panel-flat  border-primary border-top-xlg" customBody="true" customHead="true">
		
		<t:hidden path="purchaseId" value='${t_purchaseId}'/>
	</t:panel>
</t:form>

<div class="tabbable" >
	
	<div id="em" >			
		<ul class="nav nav-tabs nav-tabs-component ">
			<li class="m active"><a href="#melting-tab" data-href="melting_table" data-toggle="tab">订单详情</a></li>
			<li class="e"><a href="#element-tab" data-href="element_table" data-toggle="tab">入库记录</a></li>
			
		</ul>
		<div class="tab-content">
			<div class="tab-pane m active" id="melting-tab">
				<iframe id="melting_table" name="melting_table" scrolling="auto" frameborder="0" 
				scrolling="yes" width="100%" height="100%" data-url ="/purchase/purchase/otherDetailed"  src="">
	           </iframe>
			</div>
			
			<div class="tab-pane e" id="element-tab">
				<iframe id="element_table" name="element_table" scrolling="auto" frameborder="0" 
					scrolling="yes" width="100%" height="100%" data-url ="/purchase/purchase/purchaseIn"  src="">
	            </iframe>
			</div>
		</div>
	</div>
</div>
<script type="text/javascript">

$(function(){
	resizeEx();
	$(window).resizeend({delay : 500}, function() {
		resizeEx();
	});
	
	renderTableClick();
	
	$("a").click(function(){
		$(".m").addClass("active");
		$(".e").removeClass("active");
		$(this).addClass("active");
		
		//var purchaseId=$(".cntable.table tbody tr.select-tr").attr("data-id");
		var purchaseId=$("#purchaseId").val();
		
		var id = $(this).attr("data-href");
		var url = $.getVirtualPath() + $("#"+id).attr("data-url") + "?key="+purchaseId;
		
		$("#"+id).attr("src",url);
	}) 
	
});
function resizeEx(){
	$("#furnace").height($(window).height());
	$("#melting_table").height($(window).height());
	$("#element_table").height($(window).height());
	
}

function renderTableClick(){
	$(".cntable.table tbody tr").on("click",function(){
		$(".m").addClass("active");
		$(".e").removeClass("active");
		var purchaseId=$(this).attr("data-id");
		$("#melting_table").attr("src",$.getVirtualPath() + $("#melting_table").attr("data-url") +"?key="+purchaseId);
		$("#element_table").attr("src",$.getVirtualPath() + $("#element_table").attr("data-url") +"?key="+purchaseId);	
	});
	$(".cntable.table tbody tr:first").click().addClass("select-tr");
	
}

function refresh(){
	$("#element_table").attr("src",$("#element_table").attr("src"));
	
}
	
	function onSuccess(res){
		$("#tableContent").html(res);
		
		redrawTable();
		
		renderTableClick();
	}
	
	function searchCallback(){
		formSubmit();
	}
	function pagerChangeCallback(){
		formSubmit();
	}
	function sortingCallback(){
		formSubmit();
	}
	function formSubmit(){
		$("form:first").submit();	
	}
</script>

<%@ include file="/WEB-INF/views/shared/master/cntable.jsp"%>
<%@ include file="/WEB-INF/views/shared/base/scripts/limitless/default/notifications.jsp"%>
<%@ include file="/WEB-INF/views/shared/base/scripts/jqueryui.jsp"%>
<%@ include file="/WEB-INF/views/shared/base/scripts/limitless/default/formbuttons.jsp"%>
<%@ include file="/WEB-INF/views/shared/base/scripts/limitless/default/formstyling.jsp"%>
<%@ include file="/WEB-INF/views/shared/base/scripts/limitless/default/formselects.jsp"%>
<%@ include file="/WEB-INF/views/shared/base/scripts/limitless/default/formeditable.jsp"%>
<%@ include file="/WEB-INF/views/shared/base/scripts/limitless/default/formpickers.jsp"%>
<%@ include file="/WEB-INF/views/shared//master/contentFooter.jsp"%>